namespace TesteSharepointNovo.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.UserProfile",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.Curriculoes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Endereco = c.String(),
                        Nacionalidade = c.String(nullable: false),
                        Naturalidade = c.String(nullable: false),
                        EstadoCivil = c.String(nullable: false),
                        DataNascimento = c.DateTime(),
                        Telefone = c.String(),
                        Email = c.String(),
                        Resumo = c.String(),
                        Nome = c.String(),
                        CargoPretendido = c.String(),
                        Discriminator = c.String(nullable: false, maxLength: 128),
                        User_UserId = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.UserProfile", t => t.User_UserId)
                .Index(t => t.User_UserId);
            
            CreateTable(
                "dbo.Formacaos",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Descricao = c.String(),
                        NomeFormacao = c.String(),
                        Local = c.String(),
                        AnoInicio = c.String(),
                        AnoFinal = c.String(),
                        Curriculo_Id = c.Int(),
                        CurriculoViewModel_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Curriculoes", t => t.Curriculo_Id)
                .ForeignKey("dbo.Curriculoes", t => t.CurriculoViewModel_Id)
                .Index(t => t.Curriculo_Id)
                .Index(t => t.CurriculoViewModel_Id);
            
            CreateTable(
                "dbo.Certificacaos",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Nome = c.String(),
                        ObtidaEm = c.String(),
                        Logo = c.Binary(),
                        Curriculo_Id = c.Int(),
                        CurriculoViewModel_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Curriculoes", t => t.Curriculo_Id)
                .ForeignKey("dbo.Curriculoes", t => t.CurriculoViewModel_Id)
                .Index(t => t.Curriculo_Id)
                .Index(t => t.CurriculoViewModel_Id);
            
            CreateTable(
                "dbo.Experiencias",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        NomeEmpresa = c.String(),
                        AnoInicio = c.Int(nullable: false),
                        MesInicio = c.Int(nullable: false),
                        AnoFinal = c.String(),
                        MesFinal = c.Int(nullable: false),
                        Atividades = c.String(),
                        Curriculo_Id = c.Int(),
                        CurriculoViewModel_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Curriculoes", t => t.Curriculo_Id)
                .ForeignKey("dbo.Curriculoes", t => t.CurriculoViewModel_Id)
                .Index(t => t.Curriculo_Id)
                .Index(t => t.CurriculoViewModel_Id);
            
            CreateTable(
                "dbo.Tecnologias",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        NomeTecnologia = c.String(),
                        AutoAvaliacao = c.Int(nullable: false),
                        CurriculoViewModel_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Curriculoes", t => t.CurriculoViewModel_Id)
                .Index(t => t.CurriculoViewModel_Id);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Tecnologias", new[] { "CurriculoViewModel_Id" });
            DropIndex("dbo.Experiencias", new[] { "CurriculoViewModel_Id" });
            DropIndex("dbo.Experiencias", new[] { "Curriculo_Id" });
            DropIndex("dbo.Certificacaos", new[] { "CurriculoViewModel_Id" });
            DropIndex("dbo.Certificacaos", new[] { "Curriculo_Id" });
            DropIndex("dbo.Formacaos", new[] { "CurriculoViewModel_Id" });
            DropIndex("dbo.Formacaos", new[] { "Curriculo_Id" });
            DropIndex("dbo.Curriculoes", new[] { "User_UserId" });
            DropForeignKey("dbo.Tecnologias", "CurriculoViewModel_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Experiencias", "CurriculoViewModel_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Experiencias", "Curriculo_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Certificacaos", "CurriculoViewModel_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Certificacaos", "Curriculo_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Formacaos", "CurriculoViewModel_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Formacaos", "Curriculo_Id", "dbo.Curriculoes");
            DropForeignKey("dbo.Curriculoes", "User_UserId", "dbo.UserProfile");
            DropTable("dbo.Tecnologias");
            DropTable("dbo.Experiencias");
            DropTable("dbo.Certificacaos");
            DropTable("dbo.Formacaos");
            DropTable("dbo.Curriculoes");
            DropTable("dbo.UserProfile");
        }
    }
}
